import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/controller/my/sale_center/sale_center_logic.dart';
import 'package:sports_new/resources/colours.dart';
import 'package:sports_new/resources/styles.dart';

import '../../../utils/utils.dart';
import '../../../widgets/base/qkd_text.dart';

class SaleCenterPage extends StatelessWidget {
  const SaleCenterPage({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<SaleCenterLogic>(
      init: SaleCenterLogic(),
      builder: (logic) => Scaffold(
        body: Stack(
          alignment: Alignment.topCenter,
          children: [
            Image.asset(
                Utils.getImgPath("nav_head_back.png"),
                width: Get.width,height: Get.width*128/375
            ),
            Column(
              children: [
                Styles.appBar(
                  title: const QkdText("优惠中心"),
                  backgroundColor: Colours.transparent
                ),
                SizedBox(
                  height: 40,
                  child: Styles.tabbar(
                    controller: logic.tabController,
                    tabs: logic.tabs.map((e) => Text(e)).toList(),
                    onTap: (value) => Utils.onEvent("center_tab",params: {"tab":logic.tabs[value]})
                  ),
                ),
                const Divider(color: Colours.greyEE,height: 0.5),
                Expanded(
                  child: TabBarView(
                      controller: logic.tabController,
                      children: logic.pages
                  ),
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
